import os
import openai

# Load your API key from an environment variable or secret management service
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.api_key = "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"

# Completions
# Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
response = openai.Completion.create(model="text-davinci-003", prompt="Say this is a test", temperature=0, max_tokens=7)

print(response)

# Edits
# Given a prompt and an instruction, the model will return an edited version of the prompt.
response = openai.Edit.create(model="text-davinci-edit-001", input="What day of the wek is it?",
                              instruction="Fix the spelling mistakes")

print(response)

# Images
# Given a prompt and/or an input image, the model will generate a new image.

# Create image
response = openai.Image.create(prompt="A cute baby sea otter", n=2, size="1024x1024")

print(response)

# Create image edit
# response = openai.Image.create_edit(image='@otter.png', mask='@mask.png',
#                                     prompt="A cute baby sea otter wearing a beret", n=2, size="1024x1024")
#
# print(response)

# Create image edit
# response = openai.Image.create_variation(image='@otter.png', n=2, size="1024x1024")
#
# print(response)

